-- common_status
-- created by zhuangsl
-- 处理比较通用的状态
-- 格式为 ( prop_id, key, value, round) ,key和value未配置时默认取1
-- 必须配置value可以直接替换进描述的状态

return {
    fetchProps = function(who, status, condition)
        local props = {};
        local propId = condition["id"];
        local key    = condition["key"] or 1;
        local value  = condition["value"] or 1;
        local endRound = condition["end_round"];

        local prop = {propId, key, value, endRound};
        table.insert(props, prop);

        return props;
    end,

    desc = function(who, status, condition)
        -- 获取状态描述
        local cfg = CombatStatusM.getStatusInfo(status);
        local desc = cfg.desc;

        local propId = condition["id"];
        local value  = tonumber(condition["value"]);
        if PropM.query(propId, "type") == PROP_TYPE_RATIO then
            -- 显示为百分比的
            value = math.modf(value / 10);
        end

        desc = string.gsub(desc, "{value}", value);

        -- 特殊状态显示内容
        if status == 319 then
            desc = string.gsub(desc, "{key}", getLocStr(condition["key"]));
        end

        return desc;
    end,
};
